```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MongoDB 权威指南 - 现代开发者的数据库解决方案</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', 'Noto Serif SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f9fafb;
            color: #111827;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
        }
        .code-block {
            background-color: #1e293b;
            border-left: 4px solid #7c3aed;
        }
        .step-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .doc-pattern {
            background-color: #f3f4f6;
            background-image: 
                linear-gradient(#e5e7eb 1px, transparent 1px),
                linear-gradient(90deg, #e5e7eb 1px, transparent 1px);
            background-size: 20px 20px;
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 md:py-32 px-4 md:px-0">
        <div class="container mx-auto max-w-6xl">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold leading-tight mb-4">MongoDB <span class="text-indigo-200">权威指南</span></h1>
                    <p class="text-xl md:text-2xl text-indigo-100 mb-8">现代开发者的数据库解决方案</p>
                    <p class="text-indigo-50 mb-8 leading-relaxed">掌握NoSQL数据库核心概念，从基础安装到高级应用开发，一站式学习MongoDB全栈知识体系。</p>
                    <div class="flex space-x-4">
                        <a href="#installation" class="bg-white text-indigo-600 px-6 py-3 rounded-lg font-medium hover:bg-indigo-50 transition duration-300 shadow-md">
                            <i class="fas fa-download mr-2"></i>开始安装
                        </a>
                        <a href="#crud" class="bg-indigo-700 text-white px-6 py-3 rounded-lg font-medium hover:bg-indigo-600 transition duration-300 border border-indigo-600">
                            <i class="fas fa-code mr-2"></i>CRUD操作
                        </a>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <div class="doc-pattern p-6 rounded-xl shadow-xl">
                        <div class="code-block text-gray-100 p-6 rounded-lg overflow-x-auto">
                            <pre class="font-mono text-sm leading-relaxed">
<span class="text-purple-300">db</span>.<span class="text-blue-300">users</span>.<span class="text-yellow-300">find</span>({
    <span class="text-green-300">age</span>: { <span class="text-blue-300">$gt</span>: <span class="text-red-300">25</span> },
    <span class="text-green-300">status</span>: <span class="text-red-300">"active"</span>
}).<span class="text-yellow-300">sort</span>({ 
    <span class="text-green-300">joinDate</span>: <span class="text-red-300">-1</span> 
}).<span class="text-yellow-300">limit</span>(<span class="text-red-300">10</span>)</pre>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Installation Section -->
    <section id="installation" class="py-16 px-4 md:px-0 bg-white">
        <div class="container mx-auto max-w-6xl">
            <div class="text-center mb-16">
                <h2 class="text-3xl md:text-4xl font-bold mb-4 text-gray-800">环境搭建与部署</h2>
                <p class="text-gray-600 max-w-2xl mx-auto">多种安装方式满足不同开发场景需求，从本地开发到云端部署</p>
            </div>

            <div class="grid md:grid-cols-3 gap-8 mb-16">
                <div class="bg-white rounded-xl shadow-md overflow-hidden transition duration-300 step-card hover:border-indigo-500 border border-gray-100">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-indigo-100 p-3 rounded-full mr-4">
                                <i class="fas fa-laptop-code text-indigo-600 text-xl"></i>
                            </div>
                            <h3 class="text-xl font-semibold text-gray-800">本地开发环境</h3>
                        </div>
                        <p class="text-gray-600 mb-6">在Windows或Mac系统上配置本地MongoDB开发环境</p>
                        <div class="space-y-4">
                            <div class="flex items-start">
                                <div class="flex-shrink-0 mt-1">
                                    <div class="h-2 w-2 bg-indigo-500 rounded-full"></div>
                                </div>
                                <p class="ml-3 text-sm text-gray-700">下载官方安装包或使用包管理工具</p>
                            </div>
                            <div class="flex items-start">
                                <div class="flex-shrink-0 mt-1">
                                    <div class="h-2 w-2 bg-indigo-500 rounded-full"></div>
                                </div>
                                <p class="ml-3 text-sm text-gray-700">配置数据存储目录和日志文件</p>
                            </div>
                            <div class="flex items-start">
                                <div class="flex-shrink-0 mt-1">
                                    <div class="h-2 w-2 bg-indigo-500 rounded-full"></div>
                                </div>
                                <p class="ml-3 text-sm text-gray-700">设置环境变量和服务启动</p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="bg-white rounded-xl shadow-md overflow-hidden transition duration-300 step-card hover:border-indigo-500 border border-gray-100">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-purple-100 p-3 rounded-full mr-4">
                                <i class="fab fa-docker text-purple-600 text-xl"></i>
                            </div>
                            <h3 class="text-xl font-semibold text-gray-800">Docker部署</h3>
                        </div>
                        <p class="text-gray-600 mb-6">使用容器技术快速部署MongoDB实例</p>
                        <div class="code-block p-4 rounded-lg mb-4">
                            <pre class="font-mono text-sm text-gray-100">
<span class="text-blue-300">docker</span> run -d \
    --name mongodb \
    -p 27017:27017 \
    -v mongodb_data:/data/db \
    mongo:latest</pre>
                        </div>
                        <p class="text-sm text-gray-500">单行命令即可启动MongoDB容器</p>
                    </div>
                </div>

                <div class="bg-white rounded-xl shadow-md overflow-hidden transition duration-300 step-card hover:border-indigo-500 border border-gray-100">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-blue-100 p-3 rounded-full mr-4">
                                <i class="fas fa-cloud text-blue-600 text-xl"></i>
                            </div>
                            <h3 class="text-xl font-semibold text-gray-800">MongoDB Atlas</h3>
                        </div>
                        <p class="text-gray-600 mb-6">官方云服务，轻松管理云端数据库集群</p>
                        <div class="space-y-4">
                            <div class="flex items-start">
                                <div class="flex-shrink-0 mt-1">
                                    <div class="h-2 w-2 bg-blue-500 rounded-full"></div>
                                </div>
                                <p class="ml-3 text-sm text-gray-700">创建免费集群，无需信用卡</p>
                            </div>
                            <div class="flex items-start">
                                <div class="flex-shrink-0 mt-1">
                                    <div class="h-2 w-2 bg-blue-500 rounded-full"></div>
                                </div>
                                <p class="ml-3 text-sm text-gray-700">可视化监控和管理界面</p>
                            </div>
                            <div class="flex items-start">
                                <div class="flex-shrink-0 mt-1">
                                    <div class="h-2 w-2 bg-blue-500 rounded-full"></div>
                                </div>
                                <p class="ml-3 text-sm text-gray-700">自动备份和恢复功能</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="bg-indigo-50 rounded-xl p-8">
                <h3 class="text-xl font-semibold text-indigo-800 mb-4 flex items-center">
                    <i class="fas fa-exclamation-circle mr-2"></i> 安装注意事项
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <h4 class="font-medium text-gray-800 mb-2 flex items-center">
                            <i class="fas fa-shield-alt text-indigo-600 mr-2"></i> 安全配置
                        </h4>
                        <p class="text-gray-600 text-sm">安装后务必设置认证机制，创建管理员账户并配置访问权限控制。</p>
                    </div>
                    <div>
                        <h4 class="font-medium text-gray-800 mb-2 flex items-center">
                            <i class="fas fa-microchip text-indigo-600 mr-2"></i> 硬件要求
                        </h4>
                        <p class="text-gray-600 text-sm">生产环境建议至少4GB内存，SSD存储以获得最佳性能。</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Database Management Section -->
    <section class="py-16 px-4 md:px-0 bg-gray-50">
        <div class="container mx-auto max-w-6xl">
            <div class="flex flex-col md:flex-row items-start">
                <div class="md:w-1/3 md:pr-10 mb-10 md:mb-0">
                    <h2 class="text-3xl font-bold mb-6 text-gray-800">数据库与集合管理</h2>
                    <p class="text-gray-600 mb-6">掌握MongoDB的基本组织结构，学习如何高效管理数据库、集合和用户权限。</p>
                    
                    <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-200">
                        <h3 class="font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-key text-yellow-500 mr-2"></i> 关键概念
                        </h3>
                        <ul class="space-y-2 text-sm text-gray-600">
                            <li class="flex items-start">
                                <i class="fas fa-database text-indigo-500 mt-1 mr-2 text-xs"></i>
                                <span>数据库是MongoDB中的顶级容器</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-folder text-green-500 mt-1 mr-2 text-xs"></i>
                                <span>集合类似于关系型数据库中的表</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-file-alt text-blue-500 mt-1 mr-2 text-xs"></i>
                                <span>文档是集合中的基本数据单元</span>
                            </li>
                        </ul>
                    </div>
                </div>
                
                <div class="md:w-2/3">
                    <div class="bg-white rounded-xl shadow-md overflow-hidden">
                        <div class="border-b border-gray-200">
                            <div class="flex space-x-4 px-6 py-4 bg-gray-50">
                                <span class="h-3 w-3 rounded-full bg-red-500"></span>
                                <span class="h-3 w-3 rounded-full bg-yellow-500"></span>
                                <span class="h-3 w-3 rounded-full bg-green-500"></span>
                            </div>
                        </div>
                        <div class="p-6">
                            <div class="mb-8">
                                <h4 class="font-mono text-sm font-semibold text-gray-500 mb-3">数据库操作</h4>
                                <div class="code-block p-4 rounded-lg mb-2">
                                    <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">// 创建/切换数据库</span>
<span class="text-purple-300">use</span> mydb

<span class="text-purple-300">// 查看所有数据库</span>
<span class="text-purple-300">show</span> dbs

<span class="text-purple-300">// 删除当前数据库</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">dropDatabase</span>()</pre>
                                </div>
                            </div>
                            
                            <div class="mb-8">
                                <h4 class="font-mono text-sm font-semibold text-gray-500 mb-3">集合操作</h4>
                                <div class="code-block p-4 rounded-lg mb-2">
                                    <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">// 创建集合</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">createCollection</span>(<span class="text-green-300">"users"</span>)

<span class="text-purple-300">// 查看集合</span>
<span class="text-purple-300">show</span> collections

<span class="text-purple-300">// 删除集合</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">users</span>.<span class="text-blue-300">drop</span>()</pre>
                                </div>
                            </div>
                            
                            <div>
                                <h4 class="font-mono text-sm font-semibold text-gray-500 mb-3">用户管理</h4>
                                <div class="code-block p-4 rounded-lg">
                                    <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">// 创建用户</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">createUser</span>({
    <span class="text-blue-300">user</span>: <span class="text-green-300">"admin"</span>,
    <span class="text-blue-300">pwd</span>: <span class="text-green-300">"password"</span>,
    <span class="text-blue-300">roles</span>: [<span class="text-green-300">"readWrite"</span>]
})

<span class="text-purple-300">// 查看用户列表</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">getUsers</span>()</pre>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- CRUD Section -->
    <section id="crud" class="py-16 px-4 md:px-0 bg-white">
        <div class="container mx-auto max-w-6xl">
            <div class="text-center mb-16">
                <h2 class="text-3xl md:text-4xl font-bold mb-4 text-gray-800">CRUD操作详解</h2>
                <p class="text-gray-600 max-w-2xl mx-auto">创建、读取、更新和删除文档的基础操作，MongoDB数据管理的核心功能</p>
            </div>

            <div class="grid md:grid-cols-4 gap-6 mb-12">
                <div class="bg-indigo-50 p-6 rounded-xl border border-indigo-100">
                    <div class="text-indigo-600 mb-4">
                        <i class="fas fa-plus-circle text-3xl"></i>
                    </div>
                    <h3 class="font-semibold text-gray-800 mb-2">插入文档</h3>
                    <p class="text-gray-600 text-sm">insertOne() 和 insertMany() 方法向集合中添加新文档</p>
                </div>
                
                <div class="bg-blue-50 p-6 rounded-xl border border-blue-100">
                    <div class="text-blue-600 mb-4">
                        <i class="fas fa-search text-3xl"></i>
                    </div>
                    <h3 class="font-semibold text-gray-800 mb-2">查询文档</h3>
                    <p class="text-gray-600 text-sm">find() 方法配合查询运算符实现复杂数据检索</p>
                </div>
                
                <div class="bg-purple-50 p-6 rounded-xl border border-purple-100">
                    <div class="text-purple-600 mb-4">
                        <i class="fas fa-sync-alt text-3xl"></i>
                    </div>
                    <h3 class="font-semibold text-gray-800 mb-2">更新文档</h3>
                    <p class="text-gray-600 text-sm">updateOne() 和 updateMany() 方法修改现有文档</p>
                </div>
                
                <div class="bg-red-50 p-6 rounded-xl border border-red-100">
                    <div class="text-red-600 mb-4">
                        <i class="fas fa-trash-alt text-3xl"></i>
                    </div>
                    <h3 class="font-semibold text-gray-800 mb-2">删除文档</h3>
                    <p class="text-gray-600 text-sm">deleteOne() 和 deleteMany() 方法从集合中移除文档</p>
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-8">
                <div>
                    <h3 class="font-semibold text-lg text-gray-800 mb-4 flex items-center">
                        <i class="fas fa-edit text-indigo-600 mr-2"></i> 插入操作示例
                    </h3>
                    <div class="code-block p-4 rounded-lg mb-6">
                        <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">// 插入单个文档</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">users</span>.<span class="text-blue-300">insertOne</span>({
    <span class="text-blue-300">name</span>: <span class="text-green-300">"张三"</span>,
    <span class="text-blue-300">age</span>: <span class="text-red-300">25</span>,
    <span class="text-blue-300">email</span>: <span class="text-green-300">"zhangsan@ts.com"</span>,
    <span class="text-blue-300">hobbies</span>: [<span class="text-green-300">"游泳"</span>, <span class="text-green-300">"阅读"</span>]
})

<span class="text-purple-300">// 插入多个文档</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">users</span>.<span class="text-blue-300">insertMany</span>([
    {
        <span class="text-blue-300">name</span>: <span class="text-green-300">"李四"</span>,
        <span class="text-blue-300">age</span>: <span class="text-red-300">30</span>
    },
    {
        <span class="text-blue-300">name</span>: <span class="text-green-300">"王五"</span>,
        <span class="text-blue-300">age</span>: <span class="text-red-300">28</span>
    }
])</pre>
                    </div>
                    
                    <h3 class="font-semibold text-lg text-gray-800 mb-4 flex items-center">
                        <i class="fas fa-search-plus text-blue-600 mr-2"></i> 查询操作示例
                    </h3>
                    <div class="code-block p-4 rounded-lg">
                        <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">// 条件查询</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">users</span>.<span class="text-blue-300">find</span>({
    <span class="text-blue-300">age</span>: { <span class="text-blue-300">$gt</span>: <span class="text-red-300">25</span> },
    <span class="text-blue-300">hobbies</span>: <span class="text-green-300">"阅读"</span>
})

<span class="text-purple-300">// 排序和分页</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">users</span>.<span class="text-blue-300">find</span>()
    .<span class="text-blue-300">sort</span>({ <span class="text-blue-300">age</span>: <span class="text-red-300">-1</span> })
    .<span class="text-blue-300">skip</span>(<span class="text-red-300">10</span>)
    .<span class="text-blue-300">limit</span>(<span class="text-red-300">5</span>)</pre>
                    </div>
                </div>
                
                <div>
                    <h3 class="font-semibold text-lg text-gray-800 mb-4 flex items-center">
                        <i class="fas fa-sync text-purple-600 mr-2"></i> 更新操作示例
                    </h3>
                    <div class="code-block p-4 rounded-lg mb-6">
                        <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">// 更新单个文档</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">users</span>.<span class="text-blue-300">updateOne</span>(
    { <span class="text-blue-300">name</span>: <span class="text-green-300">"张三"</span> },
    { 
        <span class="text-blue-300">$set</span>: { <span class="text-blue-300">age</span>: <span class="text-red-300">26</span> },
        <span class="text-blue-300">$push</span>: { <span class="text-blue-300">hobbies</span>: <span class="text-green-300">"跑步"</span> }
    }
)

<span class="text-purple-300">// 更新多个文档</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">users</span>.<span class="text-blue-300">updateMany</span>(
    { <span class="text-blue-300">age</span>: { <span class="text-blue-300">$lt</span>: <span class="text-red-300">30</span> } },
    { <span class="text-blue-300">$inc</span>: { <span class="text-blue-300">age</span>: <span class="text-red-300">1</span> } }
)</pre>
                    </div>
                    
                    <h3 class="font-semibold text-lg text-gray-800 mb-4 flex items-center">
                        <i class="fas fa-trash text-red-600 mr-2"></i> 删除操作示例
                    </h3>
                    <div class="code-block p-4 rounded-lg">
                        <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">// 删除单个文档</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">users</span>.<span class="text-blue-300">deleteOne</span>({ 
    <span class="text-blue-300">name</span>: <span class="text-green-300">"张三"</span> 
})

<span class="text-purple-300">// 删除多个文档</span>
<span class="text-purple-300">db</span>.<span class="text-blue-300">users</span>.<span class="text-blue-300">deleteMany</span>({ 
    <span class="text-blue-300">age</span>: { <span class="text-blue-300">$lt</span>: <span class="text-red-300">30</span> } 
})</pre>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Tools & Data Modeling Section -->
    <section class="py-16 px-4 md:px-0 bg-gray-50">
        <div class="container mx-auto max-w-6xl">
            <div class="grid md:grid-cols-2 gap-12">
                <div>
                    <h2 class="text-3xl font-bold mb-8 text-gray-800">开发工具与数据建模</h2>
                    
                    <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                        <div class="p-6">
                            <div class="flex items-center mb-4">
                                <div class="bg-green-100 p-3 rounded-full mr-4">
                                    <i class="fas fa-terminal text-green-600 text-xl"></i>
                                </div>
                                <h3 class="text-xl font-semibold text-gray-800">MongoDB Shell</h3>
                            </div>
                            <p class="text-gray-600 mb-6">交互式JavaScript接口，用于数据库管理和数据操作</p>
                            <div class="code-block p-4 rounded-lg">
                                <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">// 连接数据库</span>
<span class="text-green-300">mongosh</span> <span class="text-red-300">"mongodb://localhost:27017/mydb"</span>

<span class="text-purple-300">// 查看帮助</span>
<span class="text-green-300">help</span>

<span class="text-purple-300">// 查看数据库状态</span>
<span class="text-green-300">db</span>.<span class="text-blue-300">serverStatus</span>()

<span class="text-purple-300">// 查看集合统计</span>
<span class="text-green-300">db</span>.<span class="text-blue-300">users</span>.<span class="text-blue-300">stats</span>()</pre>
                            </div>
                        </div>
                    </div>
                    
                    <div class="bg-white rounded-xl shadow-md overflow-hidden">
                        <div class="p-6">
                            <div class="flex items-center mb-4">
                                <div class="bg-blue-100 p-3 rounded-full mr-4">
                                    <i class="fas fa-compass text-blue-600 text-xl"></i>
                                </div>
                                <h3 class="text-xl font-semibold text-gray-800">MongoDB Compass</h3>
                            </div>
                            <p class="text-gray-600 mb-4">图形界面工具，提供直观的数据库管理体验</p>
                            <ul class="grid grid-cols-2 gap-4 text-sm text-gray-600">
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                    <span>可视化数据浏览</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                    <span>查询构建器</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                    <span>索引管理</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                    <span>性能监控</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                    <span>数据导入导出</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                    <span>聚合管道构建</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
                
                <div>
                    <h2 class="text-3xl font-bold mb-8 text-gray-800">数据建模与设计模式</h2>
                    
                    <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                        <div class="p-6">
                            <h3 class="text-xl font-semibold text-gray-800 mb-4">MongoDB数据类型</h3>
                            <div class="grid grid-cols-3 gap-4 text-sm">
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <span class="font-medium text-gray-800">String</span>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <span class="font-medium text-gray-800">Integer</span>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <span class="font-medium text-gray-800">Double</span>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <span class="font-medium text-gray-800">Boolean</span>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <span class="font-medium text-gray-800">Date</span>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <span class="font-medium text-gray-800">ObjectId</span>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <span class="font-medium text-gray-800">Array</span>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <span class="font-medium text-gray-800">Object</span>
                                </div>
                                <div class="bg-gray-50 p-3 rounded-lg">
                                    <span class="font-medium text-gray-800">Binary</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="bg-white rounded-xl shadow-md overflow-hidden">
                        <div class="p-6">
                            <h3 class="text-xl font-semibold text-gray-800 mb-4">文档设计模式</h3>
                            <div class="grid md:grid-cols-2 gap-6">
                                <div>
                                    <h4 class="font-medium text-gray-800 mb-2 flex items-center">
                                        <i class="fas fa-layer-group text-indigo-600 mr-2"></i> 内嵌文档模式
                                    </h4>
                                    <div class="code-block p-4 rounded-lg mb-2">
                                        <pre class="font-mono text-sm text-gray-100">
{
    <span class="text-blue-300">_id</span>: <span class="text-green-300">ObjectId()</span>,
    <span class="text-blue-300">name</span>: <span class="text-green-300">"张三"</span>,
    <span class="text-blue-300">address</span>: {
        <span class="text-blue-300">city</span>: <span class="text-green-300">"北京"</span>,
        <span class="text-blue-300">street</span>: <span class="text-green-300">"朝阳区"</span>
    }
}</pre>
                                    </div>
                                    <p class="text-sm text-gray-600">适用于一对一关系，查询效率高</p>
                                </div>
                                <div>
                                    <h4 class="font-medium text-gray-800 mb-2 flex items-center">
                                        <i class="fas fa-link text-blue-600 mr-2"></i> 引用模式
                                    </h4>
                                    <div class="code-block p-4 rounded-lg mb-2">
                                        <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">// users集合</span>
{
    <span class="text-blue-300">_id</span>: <span class="text-green-300">ObjectId()</span>,
    <span class="text-blue-300">name</span>: <span class="text-green-300">"张三"</span>,
    <span class="text-blue-300">address_id</span>: <span class="text-green-300">ObjectId("...")</span>
}

<span class="text-purple-300">// addresses集合</span>
{
    <span class="text-blue-300">_id</span>: <span class="text-green-300">ObjectId("...")</span>,
    <span class="text-blue-300">city</span>: <span class="text-green-300">"北京"</span>,
    <span class="text-blue-300">street</span>: <span class="text-green-300">"朝阳区"</span>
}</pre>
                                    </div>
                                    <p class="text-sm text-gray-600">适用于一对多关系，减少数据冗余</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- SpringBoot Integration Section -->
    <section class="py-16 px-4 md:px-0 bg-white">
        <div class="container mx-auto max-w-6xl">
            <div class="text-center mb-16">
                <h2 class="text-3xl md:text-4xl font-bold mb-4 text-gray-800">SpringBoot整合MongoDB</h2>
                <p class="text-gray-600 max-w-2xl mx-auto">使用Spring Data MongoDB简化Java应用开发</p>
            </div>

            <div class="grid md:grid-cols-2 gap-8">
                <div>
                    <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                        <div class="p-6">
                            <h3 class="text-xl font-semibold text-gray-800 mb-4 flex items-center">
                                <i class="fab fa-java text-red-500 mr-2"></i> 项目配置
                            </h3>
                            <div class="mb-6">
                                <h4 class="font-mono text-sm font-semibold text-gray-500 mb-2">pom.xml</h4>
                                <div class="code-block p-4 rounded-lg">
                                    <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">&lt;dependency&gt;</span>
    <span class="text-purple-300">&lt;groupId&gt;</span><span class="text-green-300">org.springframework.boot</span><span class="text-purple-300">&lt;/groupId&gt;</span>
    <span class="text-purple-300">&lt;artifactId&gt;</span><span class="text-green-300">spring-boot-starter-data-mongodb</span><span class="text-purple-300">&lt;/artifactId&gt;</span>
<span class="text-purple-300">&lt;/dependency&gt;</span></pre>
                                </div>
                            </div>
                            
                            <div>
                                <h4 class="font-mono text-sm font-semibold text-gray-500 mb-2">application.yml</h4>
                                <div class="code-block p-4 rounded-lg">
                                    <pre class="font-mono text-sm text-gray-100">
<span class="text-blue-300">spring</span>:
  <span class="text-blue-300">data</span>:
    <span class="text-blue-300">mongodb</span>:
      <span class="text-blue-300">uri</span>: <span class="text-green-300">mongodb://localhost:27017/mydb</span></pre>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="bg-white rounded-xl shadow-md overflow-hidden">
                        <div class="p-6">
                            <h3 class="text-xl font-semibold text-gray-800 mb-4 flex items-center">
                                <i class="fas fa-database text-indigo-600 mr-2"></i> 实体类定义
                            </h3>
                            <div class="code-block p-4 rounded-lg">
                                <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">@Document</span>(<span class="text-blue-300">collection</span> = <span class="text-green-300">"users"</span>)
<span class="text-purple-300">public class</span> <span class="text-yellow-300">User</span> {
    <span class="text-purple-300">@Id</span>
    <span class="text-purple-300">private</span> <span class="text-yellow-300">String</span> id;
    <span class="text-purple-300">private</span> <span class="text-yellow-300">String</span> name;
    <span class="text-purple-300">private</span> <span class="text-yellow-300">Integer</span> age;
    <span class="text-purple-300">private</span> <span class="text-yellow-300">String</span> email;
    
    <span class="text-purple-300">// getters and setters</span>
}</pre>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div>
                    <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                        <div class="p-6">
                            <h3 class="text-xl font-semibold text-gray-800 mb-4 flex items-center">
                                <i class="fas fa-code-branch text-blue-600 mr-2"></i> Repository接口
                            </h3>
                            <div class="code-block p-4 rounded-lg mb-2">
                                <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">@Repository</span>
<span class="text-purple-300">public interface</span> <span class="text-yellow-300">UserRepository</span> 
    <span class="text-purple-300">extends</span> <span class="text-yellow-300">MongoRepository</span>&lt;<span class="text-yellow-300">User</span>, <span class="text-yellow-300">String</span>&gt; {
    
    <span class="text-yellow-300">List</span>&lt;<span class="text-yellow-300">User</span>&gt; <span class="text-blue-300">findByAgeGreaterThan</span>(<span class="text-yellow-300">Integer</span> age);
    
    <span class="text-yellow-300">User</span> <span class="text-blue-300">findByEmail</span>(<span class="text-yellow-300">String</span> email);
    
    <span class="text-yellow-300">List</span>&lt;<span class="text-yellow-300">User</span>&gt; <span class="text-blue-300">findByNameLike</span>(<span class="text-yellow-300">String</span> name);
}</pre>
                            </div>
                            <p class="text-sm text-gray-600 mt-2">Spring Data自动实现接口方法，无需编写实现类</p>
                        </div>
                    </div>
                    
                    <div class="bg-white rounded-xl shadow-md overflow-hidden">
                        <div class="p-6">
                            <h3 class="text-xl font-semibold text-gray-800 mb-4 flex items-center">
                                <i class="fas fa-exchange-alt text-purple-600 mr-2"></i> 事务操作
                            </h3>
                            <div class="code-block p-4 rounded-lg mb-2">
                                <pre class="font-mono text-sm text-gray-100">
<span class="text-purple-300">@Service</span>
<span class="text-purple-300">public class</span> <span class="text-yellow-300">UserService</span> {
    <span class="text-purple-300">@Autowired</span>
    <span class="text-purple-300">private</span> <span class="text-yellow-300">MongoTemplate</span> mongoTemplate;
    
    <span class="text-purple-300">@Transactional</span>
    <span class="text-purple-300">public void</span> <span class="text-blue-300">transferPoints</span>(
        <span class="text-yellow-300">String</span> fromUserId, 
        <span class="text-yellow-300">String</span> toUserId, 
        <span class="text-yellow-300">int</span> points) {
        
        mongoTemplate.<span class="text-blue-300">updateFirst</span>(
            <span class="text-yellow-300">Query</span>.<span class="text-blue-300">query</span>(
                <span class="text-yellow-300">Criteria</span>.<span class="text-blue-300">where</span>(<span class="text-green-300">"_id"</span>)
                      .<span class="text-blue-300">is</span>(fromUserId)),
            <span class="text-yellow-300">Update</span>.<span class="text-blue-300">inc</span>(<span class="text-green-300">"points"</span>, -points),
            <span class="text-yellow-300">User</span>.<span class="text-purple-300">class</span>);
        
        mongoTemplate.<span class="text-blue-300">updateFirst</span>(
            <span class="text-yellow-300">Query</span>.<span class="text-blue-300">query</span>(
                <span class="text-yellow-300">Criteria</span>.<span class="text-blue-300">where</span>(<span class="text-green-300">"_id"</span>)
                      .<span class="text-blue-300">is</span>(toUserId)),
            <span class="text-yellow-300">Update</span>.<span class="text-blue-300">inc</span>(<span class="text-green-300">"points"</span>, points),
            <span class="text-yellow-300">User</span>.<span class="text-purple-300">class</span>);
    }
}</pre>
                            </div>
                            <p class="text-sm text-gray-600 mt-2">MongoDB 4.0+支持多文档事务操作</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Data Visualization -->
    <section class="py-16 px-4 md:px-0 bg-gray-50">
        <div class="container mx-auto max-w-6xl">
            <div class="text-center mb-12">
                <h2 class="text-3xl md:text-4xl font-bold mb-4 text-gray-800">MongoDB核心概念关系图</h2>
                <p class="text-gray-600 max-w-2xl mx-auto">通过可视化图表理解MongoDB的关键概念及其相互关系</p>
            </div>
            
            <div class="bg-white rounded-xl shadow-md p-8">
                <div class="mermaid">
                    graph TD
                        A[MongoDB数据库] --> B[集合(Collection)]
                        B --> C[文档(Document)]
                        C --> D[字段(Field)]
                        A --> E[用户(User)]
                        A --> F[角色(Role)]
                        B --> G[索引(Index)]
                        B --> H[视图(View)]
                        C --> I[内嵌文档]
                        C --> J[引用关系]
                        G --> K[单字段索引]
                        G --> L[复合索引]
                        G --> M[全文索引]
                        G --> N[地理空间索引]
                        style A fill:#1e40af,color:white
                        style B fill:#3b82f6,color:white
                        style C fill:#60a5fa,color:white
                        style D fill:#93c5fd,color:white
                        style E fill:#7c3aed,color:white
                        style F fill:#8b5cf6,color:white
                        style G fill:#10b981,color:white
                        style H fill:#34d399,color:white
                        style I fill:#f59e0b,color:white
                        style J fill:#fbbf24,color:white
                        style K fill:#059669,color:white
                        style L fill:#10b981,color:white
                        style M fill:#34d399,color:white
                        style N fill:#6ee7b7,color:white
                </div>
            </div>
        </div>
    </section>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function(e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```